package cn.yuhe.system.service.impl;


import cn.yuhe.basic.service.impl.BaseServiceImpl;
import cn.yuhe.system.domain.DictionaryType;
import cn.yuhe.system.mapper.DictionaryDetailMapper;
import cn.yuhe.system.mapper.DictionaryTypeMapper;
import cn.yuhe.system.query.DictionaryDetailQuery;
import cn.yuhe.system.service.IDictionaryTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Id;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
* @Description: 部门业务层实现类
* @Author: Mr.She
* @Version: 1.0
* @Date:  2022/6/21 16:42
*/
@Service
// 只读事务
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public class DictionaryTypeServiceImpl extends BaseServiceImpl<DictionaryType> implements IDictionaryTypeService {

    @Autowired
    private DictionaryTypeMapper dictionaryTypeMapper;

    @Autowired
    private DictionaryDetailMapper dictionaryDetailMapper;
    // 公共的条件抽取在父类中，继承即克

    // 添加部门高级查询关键字

    // private String keyword;

    // 联动删除
    public void remove(Long id) {
        // 查父级对象
        DictionaryType dictionaryType = dictionaryTypeMapper.loadById(id);
        dictionaryDetailMapper.delChild(dictionaryType.getId());
        dictionaryTypeMapper.remove(id);

    }

}
